package tables

import (
	"github.com/GoAdminGroup/go-admin/context"
	"github.com/GoAdminGroup/go-admin/modules/db"
	"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
	"github.com/GoAdminGroup/go-admin/template/types/form"
)

// GetBytedanceMiniApp return the model of table bytedance_mini_app.
func GetBytedanceMiniApp(ctx *context.Context) (stTable table.Table) {

	config := table.DefaultConfigWithDriver("postgresql")

	stTable = table.NewDefaultTable(config)

	info := stTable.GetInfo()
	info.AddField("ID", "id", db.Int)
	info.AddField("应用ID", "app_id", db.Varchar)
	info.AddField("名称", "name", db.Varchar)
	info.AddField("图标", "icon", db.Varchar)
	info.AddField("二维码URL", "qr_code_url", db.Varchar)
	info.AddField("介绍", "intro", db.Varchar)

	info.SetTable("bytedance_mini_app").SetTitle("字节跳动小程序信息").SetDescription("字节跳动小程序信息")

	formList := stTable.GetForm()
	formList.AddField("ID", "id", db.Int, form.Text)
	formList.AddField("AppID", "app_id", db.Varchar, form.Text)
	formList.AddField("名称", "name", db.Varchar, form.Text)
	formList.AddField("图标", "icon", db.Varchar, form.Text)
	formList.AddField("二维码URL", "qr_code_url", db.Varchar, form.Text)
	formList.AddField("介绍", "intro", db.Varchar, form.Text)

	formList.SetTable("bytedance_mini_app").SetTitle("字节跳动小程序信息").SetDescription("字节跳动小程序信息")
	return
}
